package com.res.system.properties;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;

import com.res.common.controller.StoreFrontController;

public class PropertySelector {

	private static PropertySelector selector = null;
	
	private Map<String, Map<String,String>> resourceContainer = null;
	
	private PropertySelector(){
		
		resourceContainer = new HashMap<String, Map<String,String>>();
	}
	
	public String select(final String catagory, final String propertyName){
		
		final Map<String,String> resourceMap = resourceContainer.get(catagory);

		return resourceMap.get(propertyName);
	}
	
	public Map<String,String> select(final String catagory){
		
		final Map<String,String> resourceMap = resourceContainer.get(catagory);
		
		return resourceMap;
	}
	
	/**
	 * 
	 * @param catagory file name of propert file.
	 * @param resourceMap
	 */
	public void update(final String catagory,final Map<String,String> resourceMap){

		resourceContainer.put(catagory, resourceMap);
	}
	
	public static PropertySelector getInstance(){
		
		if(null == selector){
			selector = new PropertySelector();
		}
		
		return selector;
	}
}
